package com.leslie.hhcommunity.config;

import com.leslie.hhcommunity.controller.interceptor.DataInterceptor;
import com.leslie.hhcommunity.controller.interceptor.LoginRequiredInterceptor;
import com.leslie.hhcommunity.controller.interceptor.LoginTicketInterceptor;
import com.leslie.hhcommunity.controller.interceptor.MessageInterceptor;
import io.netty.util.internal.UnstableApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author
 * @PackageName:com.leslie.hhcommunity.config
 * @ClassnName:WebMvcConfig
 * @Description:
 * @Date 2022/1/2  18:11
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

	@Autowired
	private LoginTicketInterceptor loginTicketInterceptor;
//	@Autowired
//	LoginRequiredInterceptor loginRequiredInterceptor;
	@Autowired
	private MessageInterceptor messageInterceptor;
	@Autowired
	private DataInterceptor dataInterceptor;

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(loginTicketInterceptor)
				.excludePathPatterns("/**/*.css", "/**/*.js", "/**/*.png", "/**/*.jpg", "/**/*.jpeg");

//		registry.addInterceptor(loginRequiredInterceptor)
//				.excludePathPatterns("/**/*.css", "/**/*.js", "/**/*.png", "/**/*.jpg", "/**/*.jpeg");

		registry.addInterceptor(messageInterceptor)
				.excludePathPatterns("/**/*.css", "/**/*.js", "/**/*.png", "/**/*.jpg", "/**/*.jpeg");

		registry.addInterceptor(dataInterceptor)
				.excludePathPatterns("/**/*.css", "/**/*.js", "/**/*.png", "/**/*.jpg", "/**/*.jpeg");
	}
}
